import request from '@/utils/request'

// 查询任务列表
export function listTask(query) {
  return request({
    url: '/oa/dispath/list',
    method: 'get',
    params: query
  })
}

// 加载对应部门人员树形结构
export function userDeptTree(id) {
  return request({
    url: '/oa/out/userDeptTree',
    method: 'get'
  })
}

// 获取任务详细信息
export function getTaskDetail(id) {
  return request({
    url: '/oa/dispath/' + id,
    method: 'get'
  })
}

// 根据任务id查询计划信息
export function getTaskPlan(id) {
  return request({
    url: '/oa/planDetail/planDispath/' + id,
    method: 'get'
  })
}

// 新增任务
export function addTask(data) {
  return request({
    url: '/oa/dispath',
    method: 'post',
    data: data
  })
}

// 修改工作计划
export function updateTask(data) {
  return request({
    url: '/oa/dispath',
    method: 'put',
    data: data
  })
}

// 删除工作计划
export function deleteTask(ids) {
  return request({
    url: '/oa/dispath/' + ids,
    method: 'delete'
  })
}

// 修改任务状态
export function editTaskState(data) {
  return request({
    url: '/oa/dispathState',
    method: 'post',
    data: data
  })
}

// 查询任务状态列表
export function taskStateList(query) {
  return request({
    url: '/oa/dispathState/list',
    method: 'get',
    params: query
  })
}
